<?php 
include('../Connections/KRAPPERCON.php');
$codcli = '';
$nif = getVal('nif');
$codcli = $_POST['t_codcli'];
$field = $_POST['field'];
$sql= "call sp_getCliente('".$codcli."','".$codcli."','".$nif."');";
//doEcho($sql);
$res = $mysqli->query($sql) or die($mysqli->error.__LINE__);

	if ($res){
	if ($row = $res->fetch_assoc()){
		if ($field == 'venta'){
			echo "{cod : '".$row['ClientID']."' ,nom : '".$row['ClientNom']." ".$row['ClientApePat']." ".$row['ClientApeMat']."', nif : '".$row['ClientNIF']."', dir : '".$row['ClientDirec']."' , dir2 : '".$row['ClientDirec2']."', ape : '".$row['ClientApePat']." ".$row['ClientApeMat']."'}";
		}
	}
	else {
			echo "{cod : '".$row['ClientID']."', nom : '' , nif : '',dir : '',dir2 : '',ape:'' }";
	}
	$res->close();
	$mysqli->check_result();
	}
?>